function setupJudgeCallSearchGrid() {
    $("#judgeCallSearch").jqGrid({
        url : 'getJudgeCallSearchList.action',
        datatype : "local",
        colNames : [ '序号', '身份证号', '姓名', '性别', '调用名', '调用目的', '调用缘由', '备注' ],
        colModel : [ {
            name : 'no',
            index : 'no',
            width : 25,
            sortable: false
        }, {
            name : 'judgeIdNo',
            index : 'judgeIdNo',
            sortable: false,
            width : 120
        }, {
            name : 'judgeName',
            index : 'judgeName',
            sortable: false,
            width : 60
        }, {
            name : 'judgeSex',
            index : 'judgeSex',
            sortable: false,
            width : 30
        }, {
            name : 'callName',
            index : 'callName',
            sortable: false,
            width : 120
        }, {
            name : 'callAim',
            index : 'callAim',
            width : 60
        }, {
            name : 'callReason',
            index : 'callReason',
            width : 220
        }, {
            name : 'callRemark',
            index : 'callRemark',
            width : 250
        } ],
        rowNum : 10,
        height : 'auto',
        rowList : [ 10, 20, 30 ],
        pager : '#pager',
        sortname : 'id',
        viewrecords : true,
        sortorder : "desc",
        caption : "评委调用信息一览",
        multiselect : false,
        loadError : dealError
    });
    $("#judgeCallSearch").jqGrid('navGrid', '#pager', {
        edit : false,
        add : false,
        del : false
    });
}

function setupJudgeCallSearchToolbar() {
    $("#search").button({
        icons : {
            primary : "ui-icon-search"
        }
    }).click(function() {
        $("#detail").dialog("open");
    });

    $("#keywordMatch").button({
        icons : {
            primary : "ui-icon-search"
        }
    }).click(function() {
        $("#keywordDetail").dialog("open");
    });

    $("#export").button({
        icons : {
            primary : "ui-icon-copy"
        }
    }).click(function() {
        $('#judgeCallSearchForm').submit();
    });
}

function setupJudgeCallSearchDialog() {
    $("#detail").dialog({
        autoOpen : false,
        show : "slide",
        height : 350,
        width : 600,
        modal : true,
        buttons : {
            检索 : function() {
                var judgeSearch = {
                    'judgeCallSearch.target.idNo' : $("#idNo").val(),
                    'judgeCallSearch.target.name' : $("#judgeName").val(),
                    'judgeCallSearch.target.sex' : $("#sex").val(),
                    'judgeCallSearch.callName' : $("#name").val(),
                    'judgeCallSearch.callAim' : $("#callAim").val(),
                    'judgeCallSearch.callReason' : $("#reason").val(),
                    'judgeCallSearch.callRemark' : $("#remark").val(),
                    'judgeCallSearch.isOr' : false
                };
                var postData = $("#judgeCallSearch").jqGrid("getGridParam", "postData");
                $.extend(postData, judgeSearch);
                $("#judgeCallSearch").jqGrid("setGridParam", {
                    search : true,
                    datatype : 'json'
                }).trigger("reloadGrid", [ {
                    page : 1
                } ]);

                $(this).dialog("close");
                return false;
            },
            取消 : function() {
                $(this).dialog("close");
                return false;
            }
        },
        close : function() {
            ;
        }
    });

    $('#keywordDetail').dialog({
        autoOpen : false,
        show : "slide",
        height : 200,
        width : 250,
        modal : true,
        buttons : {
            筛选 : function() {
                var sexCodeArray = getSexMatchCode($("#keyword").val());
                var callAimCodeArray = getCallAimMatchCode($("#keyword").val());
                var judgeSearch = {
                    'judgeCallSearch.target.idNo' : $("#keyword").val(),
                    'judgeCallSearch.target.name' : $("#keyword").val(),
                    'judgeCallSearch.target.sex' : -1,
                    'judgeCallSearch.sexCodes' : sexCodeArray.join(),
                    'judgeCallSearch.callName' : $("#keyword").val(),
                    'judgeCallSearch.callAim' : -1,
                    'judgeCallSearch.callAimCodes' : callAimCodeArray.join(),
                    'judgeCallSearch.callReason' : $("#keyword").val(),
                    'judgeCallSearch.callRemark' : $("#keyword").val(),
                    'judgeCallSearch.isOr' : true
                };
                var postData = $("#judgeCallSearch").jqGrid("getGridParam", "postData");
                $.extend(postData, judgeSearch);
                $("#judgeCallSearch").jqGrid("setGridParam", {
                    search : true,
                    datatype : "json"
                }).trigger("reloadGrid", [ {
                    page : 1
                } ]);

                $(this).dialog("close");
                return false;
            },
            解除筛选 : function() {
                var judgeSearch = {
                    'judgeCallSearch.target.idNo' : '',
                    'judgeCallSearch.target.name' : '',
                    'judgeCallSearch.target.sex' : -1,
                    'judgeCallSearch.sexCodes' : '',
                    'judgeCallSearch.callName' : '',
                    'judgeCallSearch.callAim' : -1,
                    'judgeCallSearch.callAimCodes' : '',
                    'judgeCallSearch.callReason' : '',
                    'judgeCallSearch.callRemark' : '',
                    'judgeCallSearch.isOr' : true
                };
                var postData = $("#judgeCallSearch").jqGrid("getGridParam", "postData");
                $.extend(postData, judgeSearch);
                $("#judgeCallSearch").jqGrid("setGridParam", {
                    search : true,
                    datatype : "json"
                }).trigger("reloadGrid", [ {
                    page : 1
                } ]);

                $(this).dialog("close");
                return false;
            },
            取消 : function() {
                $(this).dialog("close");
                return false;
            }
        },
        close : function() {
            ;
        }
    });
}